<?php

class User_Form_ResourceForm extends Pldkp_Form 
{ 
    protected $resource = null;
    
    public function __construct($resource = null, $options = null)
    {
        $this->resource = $resource;
        
        parent::__construct($options);
    }
    
    public function init()
    {
        $this->setName('edit_resource');
        
        $module = new Zend_Form_Element_Text('module');
        $module->setRequired(true)
               ->setLabel('Module')
               ->addValidator('NotEmpty');
               
        $controller = new Zend_Form_Element_Text('controller');
        $controller->setRequired(true)
                   ->setLabel('Controller')
                   ->addValidator('NotEmpty');
        
        $action = new Zend_Form_Element_Text('action');
        $action->setRequired(true)
               ->setLabel('Action')
               ->addValidator('NotEmpty');
           
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel($this->resource ? 'Edit' : 'Create');
        
        $this->addElements(array($module, $controller, $action, $submit));
    }
}